package com.qingke.factory;

import java.util.HashMap;
import java.util.Map;

import com.qingke.command.Command;
import com.qingke.command.DeleteCommand;
import com.qingke.command.InsertCommand;
import com.qingke.command.SelectCommand;
import com.qingke.command.UpdateCommand;

public class CommandFactory 
{
	public static enum CommandCode
	{
		INSERT,UPDATE,DELETE,SELECT
	}
	private static Map<CommandCode,Command> map;
	static
	{
		map=new HashMap<>();
		map.put(CommandCode.DELETE, new DeleteCommand());
		map.put(CommandCode.UPDATE, new UpdateCommand());
		map.put(CommandCode.SELECT, new SelectCommand());
		map.put(CommandCode.INSERT, new InsertCommand());
	}
	public Command buildCommand(CommandCode commandcode)
	{
		return map.get(commandcode);
	}
}
